﻿using System.Linq;
using CharacterCreation.Data;
using CharacterCreation.Data.Models;
using System.Reflection;

namespace CharacterCreation.Business.Repositories {
    public class GlobalRepository {
        public static void DropTables() {
            foreach (var type in typeof(Character).Assembly.GetTypes()){
                if (typeof(BaseModel).IsAssignableFrom(type))
                    typeof(DataContext).GetMethod("DropTable").MakeGenericMethod(type).Invoke(null, null);
            }
        }

        public GlobalRepository() {
            MetaDataStore MetaDataStore = new MetaDataStore();
        }

        public static void Initialize()
        {
            new SkillRepository().Initialize();
            new RaceRepository().Initialize();
            new StrengthRepository().Initialize();
            new DexterityRepository().Initialize();
            new FightingRepository().Initialize();
            new ConstitutionRepository().Initialize();
            new PerceptionRepository().Initialize();
            new IntelligenceRepository().Initialize();
            new WillPowerRepository().Initialize();
            new CharismaRepository().Initialize();
        }
    }
}
